package demo7;

import java.util.Arrays;

public class Test {

    public static void main4(String[] args) {
        String str = null;
        if(str == null) {
            throw new NullPointerException();
        }
        System.out.println(str.length());
    }

    public static void main3(String[] args) {
        String str = "Hello";
        System.out.println();
        str += " world";
        System.out.println(str);
    }
    public static void main2(String[] args) {
//        String str1 = "name=zhangSan=age=12";
//        String[] ret = str1.split("=");//以'='分割，分割后存放在字符串数组中
//        System.out.println(Arrays.toString(ret));
//        String[] ret2 = str1.split("=",3);//以'='分割，最多分三组
//        System.out.println(Arrays.toString(ret2));

        String str1 = "name=zhangSan&age=10";
        String[] ret = str1.split("=|&");//以'=' 和 '&' 分割,中间加'|'
        System.out.println(Arrays.toString(ret));
    }
    public static void main1(String[] args)
            throws CloneNotSupportedException {
        Goods goods = new Goods("苹果");
        Goods goods1 = (Goods)goods.clone();
        System.out.println("改变前goods money = " +goods.money.money );
        System.out.println("改变前goods1 money = " +goods1.money.money );

        goods1.money.money = 66.6;
        System.out.println("改变后goods money = " +goods.money.money );
        System.out.println("改变后goods1 money = " +goods1.money.money );
    }
}
